import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.DropMode;
import java.awt.Color;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.text.ParseException;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;

import javax.swing.JOptionPane;
import java.awt.Font;
import javax.swing.JFormattedTextField;
import javax.swing.text.MaskFormatter;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JSeparator;
import javax.swing.JComboBox;
import javax.swing.JSpinner;
import javax.swing.JList;
import javax.swing.JToggleButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.event.InputMethodListener;
import java.awt.event.InputMethodEvent;

public class VueExtraitCompte extends Vue {

	/**
	 * 
	 */
	//private static final long serialVersionUID = 5069349224425178639L;
	private JPanel contentPane;
	private JTextField textFieldNom;
	
	private JButton btnEnregistrer;
	private JButton btnFermer;
	private Societe	_societe ;
	private HashSet<Mandataire> _mandataires;
	private CompteSociete _compte;
	private HashSet<CompteSociete> _cpts;
	private JSeparator separator;
	private JComboBox effaceCombo;
	/**
	 * Create the frame.
	 * @throws ParseException 
	 */
	public VueExtraitCompte(Controleur controleur) throws ParseException {
		super (controleur);
		setTitle("Afficher un Extrait de Compte");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 600, 500);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblNom = new JLabel("Numéro Compte :");
		lblNom.setBounds(38, 30, 120, 16);
		contentPane.add(lblNom);
		
		textFieldNom = new JTextField();
		textFieldNom.setBounds(176, 25, 231, 28);
		textFieldNom.setBackground(new Color(255, 255, 255));
		contentPane.add(textFieldNom);
		textFieldNom.setColumns(10);
		
		btnEnregistrer = new JButton("Rechercher");
		btnEnregistrer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				String numS = textFieldNom.getText().trim().toLowerCase();
				getControleur().rechCompte(numS);
			}
		});
		btnEnregistrer.setBounds(454, 24, 117, 29);
		contentPane.add(btnEnregistrer);
		
		separator = new JSeparator();
		separator.setBounds(12, 65, 573, 3);
		contentPane.add(separator);
		
		effaceCombo = new JComboBox();
		
		btnFermer = new JButton("Fermer");
		btnFermer.setBounds(240, 436, 107, 28);
		contentPane.add(btnFermer);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(12, 82, 573, 342);
		contentPane.add(scrollPane);
		
		JTextArea infos = new JTextArea();
		scrollPane.setColumnHeaderView(infos);
		btnFermer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().fermerVue(VueExtraitCompte.this);
			}
		});
	}
	

	public void setEtat (int etat){
		switch (etat) {
		case initiale: {
			btnEnregistrer.setEnabled(true);
			break;
			}
		}
	}
	
}
